/*
 * @Description: 交易类型-消费
 * @Author: yingying.fan
 * @Date: 2019-03-18 13:38:28
 * @Last Modified by: yingying.fan
 * @Last Modified time: 2019-03-18 15:37:10
 */
<script>
import BaseConsumeItem from './BaseConsumeItem'
import { PAY_BUS, PAY_BUS_MULTIVOTE, PAY_OFFLINE, PAY_ONLINE, PAY_STAFF_MEAL } from '../../../consumedetail/constants/TradeDetailType.js'
export default {
  name: 'ConsumePayItem',
  extends: BaseConsumeItem,
  watch: {
    tradeDetailType(newValue, oldValue) {
      switch (newValue) {
        case PAY_BUS:
        case PAY_BUS_MULTIVOTE:
          this.iconUrl = require('../../assets/bus.png')
          this.tradeText = '乘坐公交' + (this.data.ROUTE_NAME ? ('-' + this.data.ROUTE_NAME) : '')
          break
        case PAY_OFFLINE:
          this.iconUrl = require('../../assets/offline.png')
          this.tradeText = '线下消费'
          break
        case PAY_ONLINE:
          this.iconUrl = require('../../assets/online.png')
          this.tradeText = this.cardName + '-线上消费'
          break
        case PAY_STAFF_MEAL:
          this.iconUrl = require('../../assets/meal.png')
          this.tradeText = '公司订餐'
          break
      }
    }
  },
  methods: {
    // 交易失败
    parseWhenTradeFailure() {
      this.stateStyle = 'fontsize28 deducte-fail'
      this.stateDesc = '扣款失败'
    },
    // 交易退款
    parseWhenTradeRefund() {
      this.stateDesc = '已退款'
    },
    // 交易成功
    parseWhenTradeSuccess() {
      this.payFeeDesc = '-' + this.payPrice
      let rideState = this.data.RIDE_STATE
      if (rideState === -1) {
        this.stateDesc = '下车未刷码'
      }
    },
    // 交易中
    parseWhenTrading() {
      this.stateDesc = '待支付'
    }
  }
}
</script>
<style scoped>
.deducte-fail {
  color: #fb3a30;
}
</style>
